package com.library.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.library.entity.BorrowRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 借阅记录Mapper接口
 *
 * @author Library Team
 */
@Mapper
public interface BorrowRecordMapper extends BaseMapper<BorrowRecord> {

    /**
     * 分页查询借阅记录（带关联查询）
     */
    IPage<BorrowRecord> selectBorrowRecordPage(Page<BorrowRecord> page, @Param("userId") Long userId);

    /**
     * 查询用户当前借阅中的书籍数量
     */
    int countBorrowedByUserId(@Param("userId") Long userId, @Param("status") String status);

}
